package edt.design.proxy;

import java.lang.reflect.InvocationHandler;

/**
 * 场景类
 * */
public class Client {

	public static void main(String[] args) {
		
		
		
		//定义一个主题
		Subject subject=new RealSubject();
		//定义一个handler
		InvocationHandler handler=new MyInvocationHandler(subject);
		//定义主题的代理
		Subject proxy=DynamicProxy.newProxyInstance(subject.getClass().getClassLoader(), subject.getClass().getInterfaces(), handler);	
		//代理的行为
		proxy.doSomething("Hello  World");
		
		System.out.println("具体业务动态代理.......");
		
		Subject prpxy2=SubjectDynamicProxy.newProxyInstance(subject);
		//代理行为
		prpxy2.doSomething("呵呵...");
	}

}
